package org.rico.controller;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by rico on 2017/1/8.
 */
@Controller
@RequestMapping(value = "/base")
public class BaseController {

    protected static Logger LOGGER = LoggerFactory.getLogger(BaseController.class);

    @RequestMapping
    public ModelAndView index() throws Exception {
        LOGGER.info("index");
        
        return new ModelAndView("index");
    }
    
    @RequestMapping(value="/json", produces = "application/json")
    @ResponseBody
    public Map<String, String> json() throws Exception {
    	Map<String, String> map = new HashMap<>();
    	map.put("name", "admin");
    	map.put("age", "21");
    	
    	return map;
    }
    
    @RequestMapping(value="/jso2n")
    @ResponseBody
    public String json2() throws Exception {
    	return "true";
    }

}
